package sv.com.renacempleo.dso.red;

import java.util.Date;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import sv.com.renacempleo.dso.BaseServiceImpl;
import sv.com.renacempleo.dto.red.RedEmpresas;
import sv.com.renacempleo.exception.WebException;
import sv.com.renacempleo.web.util.WebUtilidades;

public class RedEmpresasServiceImpl extends BaseServiceImpl implements RedEmpresasService{

	@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false, rollbackFor = {Exception.class, WebException.class})
	public void guardarEmpresa(RedEmpresas redEmpresas) throws WebException {
		// TODO Auto-generated method stub
		redEmpresas.setRedEmpresaFechaRegistro(WebUtilidades.dateFormatAsDD_MM_YYYY.format(new Date()));
		if(redEmpresas.getRedEmpresaFolio() == null)
			save(redEmpresas);
		
		update(redEmpresas);
		
	}

	@Override
	public void deleteEmpresa(Long redEmpresaFolio) throws WebException {
		// TODO Auto-generated method stub
		
	}

}
